<!-- 岗位绑定角色 首页 -->
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!-- 搜索栏-->
      <div v-if="crud.props.searchToggle">
        <el-input v-model="query.title" clearable size="small" placeholder="输入搜索条件(开发者必须修改)" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation />
      </div>
      <!-- 按钮-->
      <crud-opts :permission="permission" />
    </div>
    <!-- 表格-->
    <el-table
      ref="table"
      v-loading="crud.loading"
      :data="crud.data"
      border
      style="width: 100% "
      row-key="id"
      stripe
      tooltip-effect="dark"
      :highlight-current-row="true"
      @sort-change="crud.sortChange"
      @selection-change="crud.selectionChangeHandler"
    >
      <el-table-column type="selection" width="39" />
      <!--<el-table-column type="index" width="45" />-->

      <el-table-column prop="stationId" label="岗位id" sortable="custom" />

      <el-table-column prop="roleId" label="角色id" sortable="custom" />

      <el-table-column prop="createTime" label="创建时间" :show-overflow-tooltip="true" header-align="center" sortable="custom" />
      <el-table-column fixed="right" label="操作" width="120" header-align="center" align="center">
        <template slot-scope="scope">
          <!-- 操作按钮，简介操作的（不需要详情和扩展的），可以只引用 udOperation -->
          <udOperation
            :data="scope.row"
            :permission="permission"
          />
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页插件, 如果不需要注释掉下面一行,以及引入的 pagination 组件即可 -->
    <pagination />
    <!-- 表单 -->
    <SysStationRoleForm />
    <!-- 详情, 如果用不到，注释下面一行 -->
    <SysStationRoleInfo />
  </div>
</template>
<!-- 岗位绑定角色 首页 -->
<script>
import crudApi, { page } from '@/api/sys/StationRole'
import SysStationRoleForm from './form'
import SysStationRoleInfo from './info'
import CRUD, { presenter, header } from '@crud/crud'
import CrudOpts from '@crud/CRUD.operation'
import rrOperation from '@crud/RR.operation'
// import udOperation from '@crud/UD.operation'
import udOperation from '@crud/RUD.operation'
import pagination from '@crud/Pagination'

export default {
  name: 'SysStationRole',
  dicts: [
    'common_status'
  ], // 字典
  components: {
    CrudOpts,
    rrOperation,
    udOperation,
    pagination,
    SysStationRoleInfo,
    SysStationRoleForm
  },
  cruds() {
    return CRUD({ title: '岗位绑定角色', initDataMethod: page, crudMethod: { ...crudApi }})
  },
  mixins: [presenter(), header()],
  data() {
    return {
      permission: new Map()
    }
  },
  mounted() {
    this.permission = this.$store.state.menu.buttonPermission.get('SysStationRole')
  },
  methods: {
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
